Skip to content

Move heavy getUserDeviceKeys processing off the UI thread#2328

Open
Azare77 wants to merge 1 commit into
famedly:mainfrom
Azare77:main
Open

Move heavy getUserDeviceKeys processing off the UI thread#2328
Azare77 wants to merge 1 commit into
famedly:mainfrom
Azare77:main

Conversation

@Azare77
Copy link
Copy Markdown

@Azare77 Azare77 commented May 5, 2026

This PR moves the expensive processing inside getUserDeviceKeys
to a background isolate to avoid blocking the main/UI thread.

Large device key datasets previously caused noticeable UI freezes
during startup and sync operations.

Changes:

  • Offloaded heavy parsing/grouping work to Isolate.run
  • Kept Matrix client object construction on the main isolate
  • Reduced UI stutter during device key loading

Offloaded the expensive parts of getUserDeviceKeys to a background isolate to prevent main thread blocking during key loading and parsing.

This fixes UI freezes/stutters caused by synchronous processing of large device key datasets.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 5, 2026

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

❌ Patch coverage is 80.85106% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.05%. Comparing base (f10161c) to head (96d45ad).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
lib/src/database/matrix_sdk_database.dart 80.85% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2328      +/-   ##
==========================================
+ Coverage   55.32%   58.05%   +2.73%     
==========================================
  Files         160      160              
  Lines       19854    19876      +22     
==========================================
+ Hits        10984    11539     +555     
+ Misses       8870     8337     -533     
Files with missing lines Coverage Δ
lib/src/database/matrix_sdk_database.dart 90.64% <80.85%> (+4.42%) ⬆️

... and 26 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f10161c...96d45ad. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants